package design.patterns.structural.proxy.dynamicproxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/4/4 9:11
 */
public class LawyerInvocationHandler<T> implements InvocationHandler {
    T target;

    public LawyerInvocationHandler(T target) {
        this.target = target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(proxy.getClass());
        System.out.println("代理执行"+method.getName()+"方法");

        Object result = method.invoke(target, args);


        return  result;
    }
}
